import {
  createStore
} from 'vuex'
import axios from 'axios'
import persist from 'vuex-persistedstate'
export default createStore({
  state: {
    objList: [],
    color: ''
  },
  mutations: {
    colorChange(state, value) {
      state.color = value
    },
    pushObj(state, value) {
      state.objList.unshift({
        name: value,
        id: new Date().getTime(),
        check: 0,
        date: new Date().toLocaleString()
      })
    },
    // 改变状态
    changestate(state, {id,value}) {
      state.objList.forEach(item => {
        if (item.id == id) {
          item.check = value
        }
      })
    }
  },


  actions: {


  },
  plugins: [persist()]


})